package com.hkemm.students;

public class Computer extends Student{
    private double operation;       //操作分数，40%
    private double write_english;   //写作分数，20%
    private double final_term;      //期末分数，20%
    private double mid_term;        //期中分数，20%


    public Computer(int stu_number, String name, String sex, int age) {
        super(stu_number, name, sex, age);
    }

    public double getOperation() {
        return operation;
    }

    public void setOperation(double operation) {
        this.operation = operation;
    }

    public double getWrite_english() {
        return write_english;
    }

    public void setWrite_english(double write_english) {
        this.write_english = write_english;
    }

    public double getFinal_term() {
        return final_term;
    }

    public void setFinal_term(double final_term) {
        this.final_term = final_term;
    }

    public double getMid_term() {
        return mid_term;
    }

    public void setMid_term(double mid_term) {
        this.mid_term = mid_term;
    }

    @Override
    public void showGrade() {
        double n = 0;       //存储最终分数
        //最终成绩计算方法
        n = this.operation*0.4 + this.write_english*0.2 + this.mid_term*0.2 + this.final_term*0.2;
        n = Math.round(n*100)/100.0;        //保留两位小数

        System.out.println("学号:" + getStu_number() + "\t姓名:" + getName() + "\t性别:" + getSex() +
                "\t年龄:" + getAge() + "\t综合成绩:" + n);
    }
}
